import React, { Component, PureComponent, Suspense ,lazy} from 'react'

import ImageModal from './ImageModal'
import PdfModal from './PdfModal'
import XlsxModal from './XlsxModal'
import path from 'path'
class PreviewFileContainer extends PureComponent {

  state = {
    visible: true
  }

  render(){
    const { visible } = this.state
    const { src } = this.props
    const extName = path.extname(src).substring(1)
    const type = $g.getFileType(extName)
    return (
      <>
        {
          type === 'img' ? <ImageModal src={src} /> : extName.toLowerCase() === 'xlsx' ? <XlsxModal src={src} /> : ['doc', 'docx', 'pdf', 'xls'].includes(type) ? <PdfModal src={src}/> : null
        }
      </>
    )
  }

}

export default PreviewFileContainer